<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateCruiseCheckRectifyTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cruise_check_rectify', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('shopId')->default(0);
            $table->unsignedInteger('cruiseCheckDetailId')->default(0)->comment('巡检报告id');
            $table->unsignedInteger('cruiseOrderId')->default(0)->comment('cruise_order.id');
            $table->string('field', 64)->default('')->comment('巡检项field');
            $table->tinyInteger('status')->default(0)->comment('0待整改 1待审核 2已整改');
            $table->unsignedInteger('submitEndTime')->default(0)->comment('商家提交截止时间');
            $table->unsignedInteger('auditEndTime')->default(0)->comment('审核截止时间');
            $table->tinyInteger('lastAuditResult')->default(0)->comment('上一次审核结果 0默认 1合格 2不合格');
            $table->string('lastAuditText', 255)->default('')->comment('上一次审核内容');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '稽核 - 整改单';

            $table->index('shopId', 'idx_shopId');
            $table->index('cruiseCheckDetailId', 'idx_cruiseCheckDetailId');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('cruise_check_rectify');
    }
}
